Parallel Adder-Based DCT / IDCT Design Using Cyclic Convolution

ABSTRACT

A device and method are described that apply 1-D and 2-D discrete cosine transforms (DCT) and inverse discrete cosine transforms (IDCT) to sets of input data, typically 8×8 or 16×16 matricies of coefficients. One device includes input lines, logic to pre-add input values and generate operands and one or more adder networks that effectively carry out the multiplication operations required to apply a DCT/IDCT transform. The device may apply a 1-D transform twice to accomplish a 2-D transform. Alternatively, the device may either include successive stages of logic for the second 1-D transform or it may send data transformed once back through the same logic to pre-add and adder networks for the second 1-D transform. Calculations may be carried out after Booth encoding of operands. The processing may be split between producing v p , a vector of sums of output values, and producing v n , a vector of differences of output values, which vectors may be recombined to produce an output vector v.

PRIORITY INFORMATION

This application is a divisional of U.S. patent application Ser. No. 10/897,486, filed 23 Jul. 2004, entitled “Parallel Adder-Based DCT/IDCT Design Using Cyclic Convolution, which is a divisional of U.S. patent application Ser. No. 09/452,655, filed 1 Dec. 1999, entitled “Parallel Adder-Based DCT/IDCT Design Using Cyclic Convolution,” now U.S. Pat. No. 6,871,208.

BACKGROUND OF THE INVENTION

1. Field of the Invention

This invention relates to the calculation of discrete cosine transforms and inverse discrete cosine transforms, which are useful in signal processing. In particular, the invention relates to using an adder network for speedy calculations and economical hardware design.

2. Description of Related Art

The discrete cosine transform (DCT) is important to digital signal processing, as standards for compression of both still and video images incorporate the DCT transform and speech coding sometimes also relies on the DCT transform. Products that rely on DCT and the reciprocal inverse discrete cosine transform (IDCT) may include high definition TV (HDTV), video conferencing, digital cameras and voice compression and recognition systems. The Joint Photographic Expert Group adopted a standard for compression of still images in 1992, known as JPEG. The Moving Picture Experts Group (MPEG) of the International Organization for Standardization (ISO) has adopted or published for comment a series of standards for video compression (e.g., MPEG-2, MPEG-4, etc.) In the United States and elsewhere, standards have emerged for high definition TV (HDTV). Common to these standards is use of DCT/IDCT for data compression scheme. As DCT also is used for speech coding, its application is not limited to image data.

Several favorable mathematical properties of DCT have led to its adoption for data compression and analysis. It is real, separable, orthogonal, and approximates the statistically optimal Karhunen-Loeve transform. When factored, the DCT transform matrix contains many zeros: submaticies in the upper left and lower right quadrants of the matrix have real values and the upper right and lower left quadrants are zeros. $\left( {{E.g.},{\begin{bmatrix} {Ce} & 0 \\ 0 & {Co} \end{bmatrix}.}} \right)$ The separability property allows a two dimensional DCT to be calculated by repeated application of a one dimensional transform. For data compression, when output values are quantized and zig-zag or otherwise reordered, run length encoding or other data compression schemes can productively be applied.

Rao & Yip explain in their book Discrete Cosine Transform Algorithms, Advantages, Application (Academic Press 1990), the DCT transform was not discovered until 1974. The evolution of DCT chips only began in 1984. A substantial amount of effort has been devoted to implementing DCT in hardware. Much work has been devoted to distributed arithmetic implementations. Rao & Yip describe several distributed arithmetic devices in section 5.6 of their book. U.S. Pat. No. 5,805,482 issued to Larry Phillips is for an improved distributed arithmetic device. An article by Roger Woods, David Trainor & Jean-Paul Heron, Applying an XC6200 to Real-Time Image Processing, IEEE Design & Test of Computers, p. 30 (January-March 1998) also applies distributed arithmetic to 2-D DCT transforms.

An adder network is an alternative to distributed arithmetic which exploits the cyclic convolution property of the DCT/IDCT transform. Speed and economical hardware implementation are advantages of an adder network.

SUMMARY OF THE INVENTION

The present invention provides a device and method for applying 1-D and 2-D DCT and IDCT transforms to sets of input data.

In one embodiment, the present invention provides input lines, logic to pre-add input values to generate operands and one or more adder networks that effectively carry out the multiplication operations required to apply a DCT/IDCT transform. The adder networks may include carry save adders and an additional adder to produce a final sum. The additional adder may be a carry propagate adder. In one embodiment, input data sets may consist of eight input data values. In another embodiment, a set may consist of 16 data values. Successive sets of data may comprise an 8×8 or 16×16 matrix. The device may apply a 1-D transform twice to accomplish a 2-D transform. Alternatively, the present invention may either include successive stages of logic for the second 1-D transform or it may send data transformed once back through the same logic to pre-add and adder networks for the second 1-D transform. In either case, logic to transform a data matrix prepares the output of the first 1-D transform to be input to the second transform. Calculations may be carried out by Booth encoding of operands. The processing may be split between producing v_(p), a vector of sums of output values, and producing v_(n), a vector of differences of output values, which vectors may be recombined to produce an output vector v. Similar devices and methods apply to DCT and IDCT transformation.

Integrally a part of the logic to pre-add and to present data one set at a time, the present invention further includes permutation devices, accepting an input a set such as u₀, u₂, u₄ and u₆ and producing successive outputs sets such (u₀, u₂, u₄, u₆), (u₀, u₆, −u₄, −u₂), (u₀, −u₂, u₄, −u₆), and (u₀, −u₆, −u₄, u₂), comprising a set of muxes coupled to inputs u₀, u₂, u₄ and u₆, registers coupled to the output of said muxes and coupled to the inputs of said muxes to produce permutations, sometimes coupled directly and other times through additive inverse logic, and a control line coupled to the muxes, controlling section between inputs and register couplings.

BRIEF DESCRIPTION OF THE FIGURES

FIG. 1 illustrates an adder network to implement a sample cyclic convolution.

FIGS. 2A & B are a Booth encoded formula suitable for implementation in an adder network which illustrates the calculation of v_(p), as in $\begin{bmatrix} v_{p} \\ v_{n} \end{bmatrix} = {\begin{bmatrix} C_{e}^{T} & 0 \\ 0 & C_{o}^{T} \end{bmatrix} \cdot {\begin{bmatrix} u_{e} \\ u_{o} \end{bmatrix}.}}$

FIGS. 3A, 3B & 3C, similar to FIGS. 2A & 2B, are a Booth encoded formula suitable for implementation in an adder network which illustrates the calculation of v_(p).

FIG. 4 illustrates an embodiment of the present invention, in block diagram format.

FIG. 5 provides additional detail of an adder network portion of the present invention.

DETAILED DESCRIPTION OF THE FIGURES

To help understand this novel adder-based design for realizing the cyclic convolution formulation of DCT/IDCT, it is useful to consider a simple cyclic convolution example: $\begin{matrix} {U = {\begin{bmatrix} {u\quad 1} \\ {u\quad 2} \\ {u\quad 3} \end{bmatrix} = {\begin{bmatrix} a & b & c \\ c & a & b \\ b & c & a \end{bmatrix} \cdot \begin{bmatrix} {v\quad 1} \\ {v\quad 2} \\ {v\quad 3} \end{bmatrix}}}} & (1) \end{matrix}$ Equation (1) can be rewritten as: $\begin{matrix} {U = {\begin{bmatrix} {u\quad 1} \\ {u\quad 2} \\ {u\quad 3} \end{bmatrix} = {\begin{bmatrix} {v\quad 1} & {v\quad 2} & {v\quad 3} \\ {v\quad 2} & {v\quad 3} & {v\quad 1} \\ {v\quad 3} & {v\quad 1} & {v\quad 2} \end{bmatrix} \cdot \begin{bmatrix} a \\ b \\ c \end{bmatrix}}}} & (2) \end{matrix}$ Equations (1) and (2) are both in cyclic convolution form, as the elements in successive rows of their coefficient matricies are the same. That is, some rows of each matrix are permutations of other rows. This property is helpful in reducing the hardware complexity of an adder network for a DCT/IDCT transform. To illustrate how the cyclic convolution property is helpful, let us assume that $\begin{matrix} {\begin{bmatrix} a \\ b \\ c \end{bmatrix} = {\begin{bmatrix} 0.625 \\ 0.3125 \\ 0.125 \end{bmatrix} = \begin{bmatrix} 0.1010 \\ 0.0101 \\ 0.0010 \end{bmatrix}}} & (3) \end{matrix}$ From equations (2) and (3), we know that the output elements u1, u2, and u3 respectively can be written as $\begin{matrix} \begin{matrix} {{u\quad 1} = {{{0.1010 \cdot v}\quad 1} + {{0.0101 \cdot v}\quad 2} + {{0.0010 \cdot v}\quad 3}}} \\ {= {{\begin{bmatrix} 1 \\ 0 \\ 0 \end{bmatrix} \cdot \begin{bmatrix} {v\quad 1} \\ {v\quad 2} \\ {v\quad 3} \end{bmatrix} \cdot 2^{- 1}} + {\begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix} \cdot \begin{bmatrix} {v\quad 1} \\ {v\quad 2} \\ {v\quad 3} \end{bmatrix} \cdot 2^{- 2}} + {\begin{bmatrix} 1 \\ 0 \\ 1 \end{bmatrix} \cdot \begin{bmatrix} {v\quad 1} \\ {v\quad 2} \\ {v\quad 3} \end{bmatrix} \cdot 2^{- 3}} +}} \\ {\begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix} \cdot \begin{bmatrix} {v\quad 1} \\ {v\quad 2} \\ {v\quad 3} \end{bmatrix} \cdot 2^{- 4}} \\ {= {{v\quad{1 \cdot 2^{- 1}}} + {v\quad{2 \cdot 2^{- 2}}} + {\left( {{v\quad 1} + {v\quad 3}} \right) \cdot 2^{- 3}} + {v\quad{3 \cdot 2^{- 4}}}}} \\ {{u\quad 2} = {{{0.1010 \cdot v}\quad 2} + {{0.0101 \cdot v}\quad 3} + {{0.0010 \cdot v}\quad 1}}} \\ {= {{v\quad{2 \cdot 2^{- 1}}} + {v\quad{3 \cdot 2^{- 2}}} + {\left( {{v\quad 2} + {v\quad 1}} \right) \cdot 2^{- 3}} + {v\quad{3 \cdot 2^{- 4}}}}} \\ {{u\quad 3} = {{{0.1010 \cdot v}\quad 3} + {{0.0101 \cdot v}\quad 1} + {{0.0010 \cdot v}\quad 2}}} \\ {= {{v\quad{3 \cdot 2^{- 1}}} + {v\quad{1 \cdot 2^{- 2}}} + {\left( {{v\quad 3} + {v\quad 2}} \right) \cdot 2^{- 3}} + {v\quad{1 \cdot 2^{- 4}}}}} \end{matrix} & (4) \end{matrix}$ Equations (4) can be implemented in a network of adders, including carry save adders, which quickly compute u1, u2, and u3. An adder network to implement the cyclic convolution U according to equations (4) is illustrated in FIG. 1.

In FIG. 1, sets of input data values are introduced on input data lines 101, 102 and 103. Three sets of input data values constitute a 3×3 matrix of values. Sets of input data values are introduced to registers 111, 112 and 113 in three different orders, permuted to correspond to rows in the coefficient matrix of equation (1). Multiplication is accomplished by scaling inputs and accumulating them together in accordance with the coefficients derived in equation (4). The adders in the adder network include two or more type. Parallel bit adders, such as carry save adders 130 and 140, operate very quickly to produce intermediate sums with carry values. A carry propagate adder 150 combines outputs of the final carry save adder. One skilled in the art will appreciate that alternative types of adder can be used to combine the outputs of a carry save adder, as shown in Michael John Sebastian Smith, Application-Specific Integrated Circuits, pp. 77-86 (Addison Wesley 1997). This general illustration of implementing a cyclic convolution in an adder network emphasizes the potential advantage of having coefficients in a transform matrix that are cyclic.

The first illustration of applying this cyclic convolution approach to DCT/IDCT computation will be for the inverse discrete cosine transform. A DCT/IDCT transform matrix may be factored essentially as ${\lbrack u\rbrack = {\begin{bmatrix} C_{e} & 0 \\ 0 & C_{o} \end{bmatrix} \cdot \begin{bmatrix} v_{p} \\ v_{n} \end{bmatrix}}},$ where u is a set of output data values, C_(e) is a coefficient sub-matrix for producing even indexed output data values, C_(o) is a coefficient sub-matrix for producing odd indexed output data values, v_(p) is a vector of sums of input data values for producing even indexed output data values, and v_(n) is a vector of differences of input data values for producing odd indexed output data values. With this general form in mind, derivation of coefficients to be embodied in an adder network is given below for an 8×8 matrix of input data values. One of skill in the art will appreciate that the same approach applies to a 16×16 matrix of input data values.

To illustrate implementation of the IDCT in an adder network, we begin by reviewing the DCT transform. Using the symmetry property of the DCT coefficients, we can write the 1-D 8-point DCT as $\begin{matrix} {{{Ue} = {\begin{bmatrix} {u\quad 0} \\ {u\quad 2} \\ {u\quad 4} \\ {u\quad 6} \end{bmatrix} = {{\begin{bmatrix} {\cos\quad 4\theta} & {\cos\quad 4\theta} & {\cos\quad 4\theta} & {\cos\quad 4\theta} \\ {\cos\quad 2\theta} & {\cos\quad 6\theta} & {\cos\quad 10\theta} & {\cos\quad 14\theta} \\ {\cos\quad 4\theta} & {\cos\quad 12\theta} & {\cos\quad 20\theta} & {\cos\quad 28\theta} \\ {\cos\quad 6\theta} & {\cos\quad 18\theta} & {\cos\quad 30\theta} & {\cos\quad 42\theta} \end{bmatrix} \cdot \begin{bmatrix} {{vp}\quad 0} \\ {{vp}\quad 1} \\ {{vp}\quad 2} \\ {{vp}\quad 3} \end{bmatrix}} = {\lbrack{Ce}\rbrack \cdot \lbrack{vp}\rbrack}}}}{and}} & (5) \\ {{{Uo} = {\begin{bmatrix} {u\quad 1} \\ {u\quad 3} \\ {u\quad 5} \\ {u\quad 7} \end{bmatrix} = {{\begin{bmatrix} {\cos\quad 1\theta} & {{\cos\quad 3\theta}\quad} & {\cos\quad 5\theta} & {\cos\quad 7\theta} \\ {\cos\quad 3\theta} & {\cos\quad 9\theta} & {\cos\quad 15\theta} & {\cos\quad 21\theta} \\ {\cos\quad 5\theta} & {\cos\quad 15\theta} & {\cos\quad 25\theta} & {\cos\quad 35\theta} \\ {\cos\quad 7\theta} & {\cos\quad 21\theta} & {\cos\quad 35\theta} & {\cos\quad 49\theta} \end{bmatrix} \cdot \begin{bmatrix} {{vn}\quad 0} \\ {{vn}\quad 1} \\ {{vn}\quad 2} \\ {{vn}\quad 3} \end{bmatrix}} = {\lbrack{Co}\rbrack \cdot \lbrack{vn}\rbrack}}}}{{{where}\lbrack{vp}\rbrack} = {\begin{bmatrix} {{vp}\quad 0} \\ {{vp}\quad 1} \\ {{vp}\quad 2} \\ {{vp}\quad 3} \end{bmatrix} = \begin{bmatrix} {{v\quad 0} + {v\quad 7}} \\ {{v\quad 1} + {v\quad 6}} \\ {{v\quad 2} + {v\quad 5}} \\ {{v\quad 3} + {v\quad 4}} \end{bmatrix}}}{{{{{{{{{{and}\lbrack{vn}\rbrack} = {\begin{bmatrix} {{vn}\quad 0} \\ {{vn}\quad 1} \\ {{vn}\quad 2} \\ {{vn}\quad 3} \end{bmatrix} = \begin{bmatrix} {{v\quad 0} - {v\quad 7}} \\ {{v\quad 1} - {v\quad 6}} \\ {{v\quad 2} - {v\quad 5}} \\ {{v\quad 3} - {v\quad 4}} \end{bmatrix}}};}\lbrack{Ce}\rbrack} = \begin{bmatrix} {\cos\quad 4\theta} & {\cos\quad 4\theta} & {\cos\quad 4\theta} & {\cos\quad 4\theta} \\ {\cos\quad 2\theta} & {\cos\quad 6\theta} & {\cos\quad 10\theta} & {\cos\quad 14\theta} \\ {\cos\quad 4\theta} & {\cos\quad 12\theta} & {\cos\quad 20\theta} & {\cos\quad 28\theta} \\ {\cos\quad 6\theta} & {\cos\quad 18\theta} & {\cos\quad 30\theta} & {\cos\quad 42\theta} \end{bmatrix}};}\lbrack{Co}\rbrack} = \begin{bmatrix} {\cos\quad 1\theta} & {\cos\quad 3\theta} & {\cos\quad 5\theta} & {\cos\quad 7\theta} \\ {\cos\quad 3\theta} & {\cos\quad 9\theta} & {\cos\quad 15\theta} & {\cos\quad 21\theta} \\ {\cos\quad 5\theta} & {\cos\quad 15\theta} & {\cos\quad 25\theta} & {\cos\quad 35\theta} \\ {\cos\quad 7\theta} & {\cos\quad 21\theta} & {\cos\quad 35\theta} & {\cos\quad 49\theta} \end{bmatrix}};}{{{and}\quad\theta} = {\pi/16.}}} & (6) \end{matrix}$ Corresponding to this 1-D 8-point DCT, the inverse, IDCT can be written as $\begin{matrix} {{\lbrack{vp}\rbrack = {\begin{bmatrix} {{vp}\quad 0} \\ {{vp}\quad 1} \\ {{vp}\quad 2} \\ {{vp}\quad 3} \end{bmatrix} = {\begin{bmatrix} {{v\quad 0} + {v\quad 7}} \\ {{v\quad 1} + {v\quad 6}} \\ {{v\quad 2} + {v\quad 5}} \\ {{v\quad 3} + {v\quad 4}} \end{bmatrix} = {{\lbrack{Ce}\rbrack^{- 1} \cdot \begin{bmatrix} {u\quad 0} \\ {u\quad 2} \\ {u\quad 4} \\ {u\quad 6} \end{bmatrix}} = {\lbrack{Ce}\rbrack^{T} \cdot \lbrack{Ue}\rbrack}}}}}\quad{and}} & (7) \\ {\lbrack{vn}\rbrack = {\begin{bmatrix} {{vn}\quad 0} \\ {{vn}\quad 1} \\ {{vn}\quad 2} \\ {{vn}\quad 3} \end{bmatrix} = {\begin{bmatrix} {{v\quad 0}\quad - \quad{v\quad 7}} \\ {{v\quad 1}\quad - \quad{v\quad 6}} \\ {{v\quad 2}\quad - \quad{v\quad 5}} \\ {{v\quad 3}\quad - \quad{v\quad 4}} \end{bmatrix} = {{\lbrack{Co}\rbrack^{- 1} \cdot \begin{bmatrix} {u\quad 1} \\ {u\quad 3} \\ {u\quad 5} \\ {u\quad 7} \end{bmatrix}} = {\lbrack{Co}\rbrack^{T} \cdot \lbrack{Uo}\rbrack}}}}} & (8) \end{matrix}$ With these equations in mind, we can derive coefficients suitable to be used in an adder network for computing an inverse discrete cosine transform. Those of skill in the art will understand that the factoring of matricies is not unique. Depending on the details of factoring a matrix, the coefficients may be as above or may vary, while in fact being essentially the same.

For a 1-D 8-point IDCT, we can permute input data and rewrite equations (7) and (8), respectively, as $\begin{matrix} {\begin{bmatrix} {{vp}\quad 0} \\ {{vp}\quad 1} \\ {{vp}\quad 2} \\ {{vp}\quad 3} \end{bmatrix} = {{\begin{bmatrix} {\cos\quad 4\theta} & {\cos\quad 2\theta} & {\cos\quad 4\theta} & {\cos\quad 6\theta} \\ {\cos\quad 4\theta} & {\cos\quad 6\theta} & {\cos\quad 12\theta} & {\cos\quad 18\theta} \\ {\cos\quad 4\theta} & {\cos\quad 10\theta} & {\cos\quad 20\theta} & {\cos\quad 30\theta} \\ {\cos\quad 4\theta} & {\cos\quad 14\theta} & {\cos\quad 28\theta} & {\cos\quad 42\theta} \end{bmatrix} \cdot \begin{bmatrix} {u\quad 0} \\ {u\quad 2} \\ {u\quad 4} \\ {u\quad 6} \end{bmatrix}} = {\quad{{\begin{bmatrix} {\cos\quad 4\theta} & {\cos\quad 2\theta} & {\cos\quad 4\theta} & {\cos\quad 6\theta} \\ {\cos\quad 4\theta} & {\cos\quad 6\theta} & {{- \cos}\quad 4\theta} & {{- \cos}\quad 2\theta} \\ {\cos\quad 4\theta} & {{- \cos}\quad 6\theta} & {{- \cos}\quad 4\theta} & {\cos\quad 2\theta} \\ {\cos\quad 4\theta} & {{- \cos}\quad 2\theta} & {\cos\quad 4\theta} & {{- \cos}\quad 6\theta} \end{bmatrix} \cdot {\begin{bmatrix} {u\quad 0} \\ {u\quad 2} \\ {u\quad 4} \\ {u\quad 6} \end{bmatrix}\begin{bmatrix} {{vp}\quad 0} \\ {{vp}\quad 3} \end{bmatrix}}} = {{\begin{bmatrix} {\cos\quad 4\theta} & {\cos\quad 2\theta} & {\cos\quad 4\theta} & {\cos\quad 6\theta} \\ {\cos\quad 4\theta} & {{- \cos}\quad 2\theta} & {\cos\quad 4\theta} & {{- \cos}\quad 6\theta} \end{bmatrix} \cdot {\begin{bmatrix} {u\quad 0} \\ {u\quad 6} \\ {u\quad 4} \\ {u\quad 2} \end{bmatrix}\begin{bmatrix} {{vp}\quad 1} \\ {{vp}\quad 2} \end{bmatrix}}} = {{\begin{bmatrix} {\cos\quad 4\theta} & {{- \cos}\quad 2\theta} & {\cos\quad 4\theta} & {\cos\quad 6\theta} \\ {\cos\quad 4\theta} & {\cos\quad 2\theta} & {{- \cos}\quad 4\theta} & {{- \cos}\quad 6\theta} \end{bmatrix} \cdot {\begin{bmatrix} {u\quad 0} \\ {u\quad 6} \\ {u\quad 4} \\ {u\quad 2} \end{bmatrix}\begin{bmatrix} {{vp}\quad 0} & {{vp}\quad 3} & {{vp}\quad 1} & {{vp}\quad 2} \end{bmatrix}}} = {\quad{\begin{bmatrix} {\cos\quad 4\theta} & {\cos\quad 2\theta} & {\cos\quad 4\theta} & {\cos\quad 6\theta} \end{bmatrix} \cdot {\quad\begin{bmatrix} {u\quad 0} & {u\quad 0} & {u\quad 0} & {u\quad 0} \\ {u\quad 2} & {{- u}\quad 2} & {{- u}\quad 6} & {u\quad 6} \\ {u\quad 4} & {u\quad 4} & {{- u}\quad 4} & {{- u}\quad 4} \\ {u\quad 6} & {{- u}\quad 6} & {u\quad 2} & {{- u}\quad 2} \end{bmatrix}}}}}}}}}} & (9) \\ {\begin{bmatrix} {{vn}\quad 0} \\ {{vn}\quad 1} \\ {{vn}\quad 2} \\ {{vn}\quad 3} \end{bmatrix} = {{\begin{bmatrix} {\cos\quad 1\theta} & {\cos\quad 3\theta} & {\cos\quad 5\theta} & {\cos\quad 7\theta} \\ {\cos\quad 3\theta} & {\cos\quad 9\theta} & {\cos\quad 15\theta} & {\cos\quad 21\theta} \\ {\cos\quad 5\theta} & {\cos\quad 15\theta} & {\cos\quad 25\theta} & {\cos\quad 35\theta} \\ {\cos\quad 7\theta} & {\cos\quad 21\theta} & {\cos\quad 35\theta} & {\cos\quad 49\theta} \end{bmatrix} \cdot \begin{bmatrix} {u\quad 1} \\ {u\quad 3} \\ {u\quad 5} \\ {u\quad 7} \end{bmatrix}} = {\quad{{\begin{bmatrix} {\cos\quad 1\theta} & {\cos\quad 3\theta} & {\cos\quad 5\theta} & {\cos\quad 7\theta} \\ {\cos\quad 3\theta} & {{- \cos}\quad 7\theta} & {{- \cos}\quad 1\theta} & {{- \cos}\quad 5\theta} \\ {\cos\quad 5\theta} & {{- \cos}\quad 1\theta} & {\cos\quad 7\theta} & {\cos\quad 3\theta} \\ {\cos\quad 7\theta} & {{- \cos}\quad 5\theta} & {\cos\quad 3\theta} & {{- \cos}\quad 1\theta} \end{bmatrix} \cdot \begin{bmatrix} {u\quad 1} \\ {u\quad 3} \\ {u\quad 5} \\ {u\quad 7} \end{bmatrix}}{\quad{\begin{bmatrix} {{vn}\quad 2} \\ {{vn}\quad 0} \\ {{vn}\quad 1} \\ {{vn}\quad 3} \end{bmatrix} = {{\begin{bmatrix} {{- \cos}\quad 1\theta} & {\cos\quad 3\theta} & {\cos\quad 7\theta} & {\cos\quad 5\theta} \\ {\cos\quad 3\theta} & {\cos\quad 7\theta} & {\cos\quad 5\theta} & {\cos\quad 1\theta} \\ {{- \cos}\quad 7\theta} & {{- \cos}\quad 5\theta} & {{- \cos}\quad 1\theta} & {\cos\quad 3\theta} \\ {{- \cos}\quad 5\theta} & {{- \cos}\quad 1\theta} & {\cos\quad 3\theta} & {\cos\quad 7\theta} \end{bmatrix} \cdot {\begin{bmatrix} {u\quad 3} \\ {u\quad 7} \\ {u\quad 5} \\ {u\quad 1} \end{bmatrix}\begin{bmatrix} {{vn}\quad 2} & {{vn}\quad 0} & {{vn}\quad 1} & {{vn}\quad 3} \end{bmatrix}}} = {\quad{\begin{bmatrix} {\cos\quad 1\theta} & {\cos\quad 3\theta} & {\cos\quad 7\theta} & {\cos\quad 5\theta} \end{bmatrix} \cdot {\quad\begin{bmatrix} {{- u}\quad 3} & {u\quad 1} & {{- u}\quad 5} & {{- u}\quad 7} \\ {u\quad 7} & {u\quad 3} & {u\quad 1} & {u\quad 5} \\ {u\quad 5} & {u\quad 7} & {{- u}\quad 3} & {u\quad 1} \\ {u\quad 1} & {u\quad 5} & {{- u}\quad 7} & {{- u}\quad 3} \end{bmatrix}}}}}}}}}}} & (10) \end{matrix}$ From equations (9) and (10), we design one or more adder networks to calculate both vectors v_(p) and v_(n).

Modified Booth encoding of the coefficients processed by the adder network can further improve the speed of the present invention. Booth encoding is a family of techniques for changing the representation of a binary number so that fewer addition and accumulate steps will be required to accomplish a multiplication. An overview of encoding techniques that may suitably be used with the present invention appears in Smith, Application Specific Integrated Circuits, pp. 87-90. See also, A. D. Booth, A Signed Binary Multiplication Technique, A. J. Mech. Appl. Math., pp. 260-64 (April 1951); L. P. Rubinfield, A Proof of the Modified Booth Algorithm for Multiplication, IEEE Trans. on Computers, vol. C-24, pp. 1014-15 (October 1975); Romesh M. Jessani & Michael Putrino, Comparison of Single- and Dual-Pass Multiply-Add Fused Floating-Point Units, IEEE Trans. on Computers, vol. 47, pp. 927-37 (September 1998). Booth encoding may be applied to the IDCT coefficient submatricies factored above.

The IDCT coefficients of equations (9) and (10) can be written in their 16-bit binary form $\begin{matrix} {{\begin{bmatrix} {\cos\quad 4\quad\theta} \\ {\cos\quad 2\quad\theta} \\ {\cos\quad 6\quad\theta} \end{bmatrix} = {\begin{bmatrix} 0.707106781 \\ 0.923879532 \\ 0.382683432 \end{bmatrix} = \begin{bmatrix} 0.1011 & 0101 & 0000 & 0101 \\ 0.1110 & 1100 & 1000 & 0011 \\ 0.0110 & 0001 & 1111 & 1000 \end{bmatrix}}}\quad{{{as}\begin{bmatrix} {\cos\quad 1\quad\theta} \\ {\cos\quad 3\quad\theta} \\ {\cos\quad 7\quad\theta} \\ {\cos\quad 6\quad\theta} \end{bmatrix}} = {\begin{bmatrix} 0.98078528 \\ 0.831469612 \\ 0.195090322 \\ 0.555570233 \end{bmatrix} = \begin{bmatrix} 0.1111 & 1011 & 0001 & 0101 \\ 0.1101 & 0100 & 1101 & 1011 \\ 0.0011 & 0001 & 1111 & 0010 \\ 0.1000 & 1110 & 0011 & 1010 \end{bmatrix}}}} & (11) \end{matrix}$ The coefficients in (11) often have several the consecutive binary “1”s. These consecutive “1”s require consecutive addition operations. In order to reduce the number of addition operations, the binary values can be recoded, using Booth encoding. Booth encoding expresses a value using different format than standard binary representation. To illustrate, if you have a number whose standard binary representation is 0111, it also can be expressed as 100 I, where I denotes the digit −1. That is, the decimal value of 0111 is 7, which is equal to 100 I (i.e., 1×2³+0×2²+0×2¹+(−1)×2⁰=8+0+0+(−1)=7). This reduces the reduce the number of “1”s in the binary representation of a number, thereby reducing the number of operands to be added together and reducing the hardware cost of an adder network. When a coefficient has more than 3 consecutive “1”s in its standard binary representation, efficiency can be gained by application of Booth encoding to translate the coefficient from standard binary representation into a different representation such as sign-digit representation. So (11) can be rewritten based on modified Booth encoding as $\begin{matrix} {\begin{bmatrix} {\cos\quad 4\theta} \\ {\cos\quad 2\theta} \\ {\cos\quad 6\quad\theta} \end{bmatrix} = {\begin{bmatrix} 0.707106781 \\ 0.923879532 \\ 0.382683432 \end{bmatrix} = {{\begin{bmatrix} 0.1011 & 0101 & 0000 & 0101 \\ {1.000\overset{\_}{1}} & {0\overset{\_}{1}00} & 1000 & 0011 \\ {0.10\overset{\_}{1}0} & 0010 & 0000 & {\overset{\_}{1}000} \end{bmatrix}\begin{bmatrix} {\cos\quad 1\quad\theta} \\ {\cos\quad 3\theta} \\ {\cos\quad 7\theta} \\ {\cos\quad 5\theta} \end{bmatrix}} = {\begin{bmatrix} 0.98078528 \\ 0.831469612 \\ 0.195090322 \\ 0.555570233 \end{bmatrix} = \begin{bmatrix} 1.0000 & {0\overset{\_}{1}0\overset{\_}{1}} & 0001 & 0101 \\ {1.0\overset{\_}{1}01} & 0101 & {00\overset{\_}{1}0} & {0\overset{\_}{1}0\overset{\_}{1}} \\ {0.010\overset{\_}{1}} & 0010 & {000\overset{\_}{1}} & 0001 \\ 0.1001 & {00\overset{\_}{1}0} & 0100 & {\overset{\_}{1}010} \end{bmatrix}}}}} & (12) \end{matrix}$ Using the binary form of the IDCT cosine coefficients in (12), we can exploit the adder-based design approach to write the inner products in the IDCT computation as a series of additions and accumulations, based on equations (9) and (10).

The IDCT output data set v preferably is processed as v_(p) and v_(n). From equation (9), we see that the coefficients for calculation of elements of the vector v_(p) are practically the same, so it is enough to consider the hardware circuit realization of a single element of the vector such as v_(p0). The computation of the output element v_(p0) can be expressed as shown in FIGS. 2A and 2B. In FIG. 2A, the calculation takes into account each of the coefficients that appear in equation (9), using the encoded representation of equations (12). Equation (13) shows how intermediate sums need to be accumulated to calculate v_(p0). The input permutations of FIG. 2B, are used for calculation of v_(p0) . . . v_(p3). The generality of equation (13) shows that one adder network can capture all of the coefficients need to calculate the vector v_(p), requiring only permutation or preadding of input data values that accepted in parallel by the adder network to calculate the required inner products.

To further simplify equation (13) of FIGS. 2AS & 2B, let X=d0+d2. For v_(p0), equation (13) becomes vp0=d1+(X+d3)·2⁻¹+(X−d3)·2⁻³+(X−d1)·2⁻⁴+(X−d1)·2⁻⁶ +d3·2⁻⁷ +X·2⁻⁸ +d1·2⁻⁹+(−d3)·2⁻¹³ +X·2⁻¹⁴ +d1·2⁻¹⁵ +(X+d1)·2⁻¹⁶ The present invention includes an adder network that accumulates this sum or a sum that is essentially the same. The present invention can use IDCT coefficients that are factored or encoded differently than in equation (14). In a preferred embodiment of the present invention, 16-bit input values are segmented into least and most significant digits and accumulated in two parts, being combined after the two parts have been separately summed.

FIGS. 3A, 3B and 3C illustrate the same approach to accumulating the values of elements of v_(n) is applied above to v_(p). Again, an embodiment of the present invention is an adder network that accumulates the sum in equation (16) of FIG. 3C or a sum that is essentially the same. The present invention extends to both IDCT and DCT transforms.

For a 1-D 8-point DCT, the matrix representation has been shown in equations (5) and (6) to be the following: $\begin{matrix} {\begin{matrix} {{Ue} = \begin{bmatrix} {u\quad 0} \\ {u\quad 2} \\ {u\quad 4} \\ {u\quad 6} \end{bmatrix}} \\ {= {\begin{bmatrix} {\cos\quad 4\theta} & {\cos\quad 4\quad\theta} & {\cos\quad 4\theta} & {\cos\quad 4\theta} \\ {\cos\quad 2\quad\theta} & {\cos\quad 6\theta} & {\cos\quad 10\theta} & {\cos\quad 14\theta} \\ {\cos\quad 4\theta} & {\cos\quad 12\theta} & {\cos\quad 20\theta} & {\cos\quad 28\theta} \\ {\cos\quad 6\theta} & {\cos\quad 18\theta} & {\cos\quad 30\theta} & {\cos\quad 42\theta} \end{bmatrix} \cdot \begin{bmatrix} {{vp}\quad 0} \\ {{vp}\quad 1} \\ {{vp}\quad 2} \\ {{vp}\quad 3} \end{bmatrix}}} \\ {= {\lbrack{Ce}\rbrack \cdot \lbrack{vp}\rbrack}} \end{matrix}} & (17) \\ \begin{matrix} {{Uo} = \begin{bmatrix} {u\quad 1} \\ {u\quad 3} \\ {u\quad 5} \\ {u\quad 7} \end{bmatrix}} \\ {= {\begin{bmatrix} {\cos\quad 1\theta} & {\cos\quad 3\theta} & {\cos\quad 5\theta} & {\cos\quad 7\theta} \\ {\cos\quad 3\theta} & {\cos\quad 9\theta} & {\cos\quad 15\theta} & {\cos\quad 21\theta} \\ {\cos\quad 5\theta} & {\cos\quad 15\theta} & {\cos\quad 20\theta} & {\cos\quad 28\theta} \\ {\cos\quad 7\theta} & {\cos\quad 21\theta} & {\cos\quad 35\theta} & {\cos\quad 49\theta} \end{bmatrix} \cdot \begin{bmatrix} {{vn}\quad 0} \\ {{vn}\quad 1} \\ {{vn}\quad 2} \\ {{vn}\quad 3} \end{bmatrix}}} \\ {= {\lbrack{Co}\rbrack \cdot \lbrack{vn}\rbrack}} \end{matrix} & (18) \\ {\begin{matrix} {{Uo} = \begin{bmatrix} {u\quad 1} \\ {u\quad 3} \\ {u\quad 5} \\ {u\quad 7} \end{bmatrix}} \\ {= {\begin{bmatrix} {\cos\quad 1\theta} & {\cos\quad 3\theta} & {\cos\quad 5\theta} & {\cos\quad 7\theta} \\ {\cos\quad 3\theta} & {\cos\quad 9\theta} & {\cos\quad 15\theta} & {\cos\quad 21\theta} \\ {\cos\quad 5\theta} & {\cos\quad 15\theta} & {\cos\quad 25\theta} & {\cos\quad 35\theta} \\ {\cos\quad 7\theta} & {\cos\quad 21\theta} & {\cos\quad 35\theta} & {\cos\quad 49\theta} \end{bmatrix} \cdot {\quad\begin{bmatrix} {{vn}\quad 0} \\ {{vn}\quad 1} \\ {{vn}\quad 2} \\ {{vn}\quad 3} \end{bmatrix}}}} \\ {= {\lbrack{Co}\rbrack \cdot \lbrack{vn}\rbrack}} \end{matrix}{{{{where}\lbrack{vp}\rbrack} = {\begin{bmatrix} {{vp}\quad 0} \\ {{vp}\quad 1} \\ {{vp}\quad 2} \\ {{vp}\quad 3} \end{bmatrix} = \begin{bmatrix} {{v\quad 0} + {v\quad 7}} \\ {{v\quad 1} + {v\quad 6}} \\ {{v\quad 2} + {v\quad 5}} \\ {{v\quad 3} + {v\quad 4}} \end{bmatrix}}};}} & \quad \\ {{{{{and}\lbrack{vn}\rbrack} = {\begin{bmatrix} {{vn}\quad 0} \\ {{vn}\quad 1} \\ {{vn}\quad 2} \\ {{vn}\quad 3} \end{bmatrix} = \begin{bmatrix} {{v\quad 0} - {v\quad 7}} \\ {{v\quad 1} - {v\quad 6}} \\ {{v\quad 2} - {v\quad 5}} \\ {{v\quad 3} - {v\quad 4}} \end{bmatrix}}};}{{\lbrack{Ce}\rbrack = \begin{bmatrix} {\cos\quad 4\theta} & {\cos\quad 4\theta} & {\cos\quad 4\theta} & {\cos\quad 4\theta} \\ {\cos\quad 2\theta} & {\cos\quad 6\theta} & {\cos\quad 10\theta} & {\cos\quad 14\theta} \\ {\cos\quad 4\theta} & {\cos\quad 12\theta} & {\cos\quad 20\theta} & {\cos\quad 28\theta} \\ {\cos\quad 6\theta} & {\cos\quad 18\theta} & {\cos\quad 30\theta} & {\cos\quad 42\theta} \end{bmatrix}};}{{\lbrack{Co}\rbrack = \begin{bmatrix} {\cos\quad 1\theta} & {\cos\quad 3\theta} & {\cos\quad 5\theta} & {\cos\quad 7\theta} \\ {\cos\quad 3\theta} & {\cos\quad 9\theta} & {\cos\quad 15\theta} & {\cos\quad 21\theta} \\ {\cos\quad 5\theta} & {\cos\quad 15\theta} & {\cos\quad 25\theta} & {\cos\quad 35\theta} \\ {\cos\quad 7\theta} & {\cos\quad 21\theta} & {\cos\quad 35\theta} & {\cos\quad 49\theta} \end{bmatrix}};}{and}\quad{\theta = {\pi/16.}}} & \quad \end{matrix}$ Simplifying the cosine coefficients based on their periodic nature and permuting some of the elements of the vector v_(n), we can rewrite the DCT equations (17) and (18) in essentially the same form as the IDCT equations. That is, $\begin{matrix} {\lbrack{Ue}\rbrack = {\begin{bmatrix} {u\quad 0} \\ {u\quad 2} \\ {u\quad 4} \\ {u\quad 6} \end{bmatrix} = {\begin{bmatrix} {\cos\quad 4\theta} & {\cos\quad 4\theta} & {\cos\quad 4\theta} & {\cos\quad 4\theta} \\ {\cos\quad 2\theta} & {\cos\quad 6\theta} & {{- \cos}\quad 6\theta} & {{- \cos}\quad 2\theta} \\ {\cos\quad 4\theta} & {{- \cos}\quad 4\theta} & {{- \cos}\quad 4\theta} & {\cos\quad 4\theta} \\ {\cos\quad 6\theta} & {{- \cos}\quad 2\theta} & {\cos\quad 2\theta} & {{- \cos}\quad 6\theta} \end{bmatrix} \cdot \begin{bmatrix} {{vp}\quad 0} \\ {{vp}\quad 1} \\ {{vp}\quad 2} \\ {{vp}\quad 3} \end{bmatrix}}}} & (19) \\ {\lbrack{Uo}\rbrack = {\begin{bmatrix} {u\quad 1} \\ {u\quad 3} \\ {u\quad 5} \\ {u\quad 7} \end{bmatrix} = {{\begin{bmatrix} {\cos\quad 1\theta} & {\cos\quad 3\theta} & {\cos\quad 5\theta} & {\cos\quad 7\theta} \\ {\cos\quad 3\theta} & {{- \cos}\quad 7\theta} & {{- \cos}\quad 1\theta} & {{- \cos}\quad 5\theta} \\ {\cos\quad 5\theta} & {{- \cos}\quad 1\theta} & {\cos\quad 7\theta} & {\cos\quad 3\theta} \\ {\cos\quad 7\theta} & {{- \cos}\quad 5\theta} & {\cos\quad 3\theta} & {{- \cos}\quad 1\theta} \end{bmatrix} \cdot \begin{bmatrix} {{vn}\quad 0} \\ {{vn}\quad 1} \\ {{vn}\quad 2} \\ {{vn}\quad 3} \end{bmatrix}}\quad = {\begin{bmatrix} {u\quad 3} \\ {u\quad 7} \\ {u\quad 5} \\ {u\quad 1} \end{bmatrix} = {\begin{bmatrix} {{- \cos}\quad 1\theta} & {\cos\quad 3\theta} & {{- \cos}\quad 7\theta} & {{- \cos}\quad 5\theta} \\ {\cos\quad 3\theta} & {\cos\quad 7\theta} & {{- \cos}\quad 5\theta} & {{- \cos}\quad 1\theta} \\ {\cos\quad 7\theta} & {\cos\quad 5\theta} & {{- \cos}\quad 1\theta} & {\cos\quad 3\theta} \\ {\cos\quad 5\theta} & {\cos\quad 1\theta} & {\cos\quad 3\theta} & {\cos\quad 7\theta} \end{bmatrix} \cdot \begin{bmatrix} {{vn}\quad 2} \\ {{vn}\quad 0} \\ {{vn}\quad 1} \\ {{vn}\quad 3} \end{bmatrix}}}}}} & (20) \end{matrix}$ For purposes of implementing these coefficients in one or more adder networks, it is useful to subdivide [Ue] and to rewrite these equations with one row of coefficients. $\begin{matrix} {\begin{bmatrix} {u\quad 0} \\ {u\quad 4} \end{bmatrix} = {\begin{bmatrix} {\cos\quad 4\theta} & {\cos\quad 4\theta} & {\cos\quad 4\theta} & {\cos\quad 4\theta} \\ {\cos\quad 4\theta} & {{- \cos}\quad 4\theta} & {{- \cos}\quad 4\theta} & {\cos\quad 4\theta} \end{bmatrix} \cdot \begin{bmatrix} {{vp}\quad 0} \\ {{vp}\quad 1} \\ {{vp}\quad 2} \\ {{vp}\quad 3} \end{bmatrix}}} & (21) \\ {\begin{bmatrix} {u\quad 0} & {u\quad 4} \end{bmatrix} = {\begin{bmatrix} {\cos\quad 4\theta} & {\cos\quad 4\theta} & {\cos\quad 4\theta} & {\cos\quad 4\theta} \end{bmatrix} \cdot \begin{bmatrix} {{vp}\quad 0} & {{vp}\quad 0} \\ {{vp}\quad 1} & {{- {vp}}\quad 1} \\ {{vp}\quad 2} & {{- {vp}}\quad 2} \\ {{vp}\quad 3} & {{vp}\quad 3} \end{bmatrix}}} & \quad \\ {\begin{bmatrix} {u\quad 2} \\ {u\quad 6} \end{bmatrix} = {\begin{bmatrix} {\cos\quad 2\theta} & {\cos\quad 6\theta} & {{- \cos}\quad 6\theta} & {{- \cos}\quad 2\theta} \\ {\cos\quad 6\theta} & {{- \cos}\quad 2\theta} & {\cos\quad 2\theta} & {{- \cos}\quad 6\theta} \end{bmatrix} \cdot \begin{bmatrix} {{vp}\quad 0} \\ {{vp}\quad 1} \\ {{vp}\quad 2} \\ {{vp}\quad 3} \end{bmatrix}}} & \quad \\ {{\begin{bmatrix} {u\quad 2} & {u\quad 6} \end{bmatrix} = {\begin{bmatrix} {\cos\quad 2\theta} & {\cos\quad 6\theta} & {\cos\quad 2\theta} & {\cos\quad 6\theta} \end{bmatrix} \cdot \begin{bmatrix} {{vp}\quad 0} & {{vp}\quad 2} \\ {{vp}\quad 1} & {{vp}\quad 0} \\ {{- {vp}}\quad 3} & {{- {vp}}\quad 1} \\ {{- {vp}}\quad 2} & {{- {vp}}\quad 3} \end{bmatrix}}}{and}} & \quad \\ {\begin{bmatrix} {u\quad 3} & {u\quad 7} & {u\quad 5} & {u\quad 1} \end{bmatrix} = {\quad{\begin{bmatrix} {\cos\quad 1\theta} & {\cos\quad 3\theta} & {\cos\quad 7\theta} & {\cos\quad 5\theta} \end{bmatrix} \cdot {\quad\begin{bmatrix} {{- {vn}}\quad 2} & {{- {vn}}\quad 3} & {{- {vn}}\quad 1} & {{vn}\quad 0} \\ {{vn}\quad 0} & {{vn}\quad 2} & {{vn}\quad 3} & {{vn}\quad 1} \\ {{- {vn}}\quad 1} & {{vn}\quad 0} & {{vn}\quad 2} & {{vn}\quad 3} \\ {{- {vn}}\quad 3} & {{- {vn}}\quad 1} & {{vn}\quad 0} & {{vn}\quad 2} \end{bmatrix}}}}} & (22) \end{matrix}$

The output data set u preferably is processed as u_(o) and u_(e). The coefficients to produce u_(o) in DCT equation (22) are the same as the coefficients in the IDCT equation (10), which implies that one of the same adder networks used for IDCT calculation can be used for DCT calculation of the vector u_(o), needing only to change how the input data values are combined before they reach the adder network. For the values of the vector d in equation (13) of FIG. 2B, the following combination of input data values can be used to implement equation (22). $\begin{matrix} {\begin{bmatrix} {d\quad 0} \\ {d\quad 1} \\ {d\quad 2} \\ {d\quad 3} \end{bmatrix} = \begin{pmatrix} \begin{bmatrix} {{- {vn}}\quad 2} \\ {{vn}\quad 0} \\ {{- {vn}}\quad 1} \\ {{- {vn}}\quad 3} \end{bmatrix} & {{for}\quad u\quad 3} \\ \begin{bmatrix} {{- {vn}}\quad 3} \\ {{vn}\quad 2} \\ {{vn}\quad 0} \\ {{- {vn}}\quad 1} \end{bmatrix} & {{for}\quad u\quad 7} \\ \begin{bmatrix} {{- {vn}}\quad 1} \\ {{vn}\quad 3} \\ {{vn}\quad 2} \\ {{vn}\quad 0} \end{bmatrix} & {{for}\quad u\quad 5} \\ \begin{bmatrix} {{vn}\quad 0} \\ {{vn}\quad 1} \\ {{vn}\quad 3} \\ {{vn}\quad 2} \end{bmatrix} & {{for}\quad u\quad 1} \end{pmatrix}} & (23) \end{matrix}$

The adder networks to implement DCT equation (21) differ from the networks to implement the IDCT equations, as different cosine coefficients appear. As in equation (21), it is useful to subdivide calculation of the vector u_(o). For purposes of implementing an adder network, the u0 and u4 elements of the output data set can be calculated as $\begin{matrix} {{\left\lbrack u_{0\quad{or}\quad 4} \right\rbrack = {\begin{bmatrix} {\cos\quad 4\theta} & {\cos\quad 4\theta} & {\cos\quad 4\theta} & {\cos\quad 4\theta} \end{bmatrix} \cdot \begin{bmatrix} {d\quad 0} \\ {d\quad 1} \\ {d\quad 2} \\ {d\quad 3} \end{bmatrix}}}{{{where}\begin{bmatrix} {d\quad 0} \\ {d\quad 1} \\ {d\quad 2} \\ {d\quad 3} \end{bmatrix}} = \begin{pmatrix} \begin{bmatrix} {{vp}\quad 0} \\ {{vp}\quad 1} \\ {{vp}\quad 2} \\ {{vp}\quad 3} \end{bmatrix} & {{for}\quad u\quad 0} \\ \begin{bmatrix} {{vp}\quad 0} \\ {{- {vp}}\quad 1} \\ {{- {vp}}\quad 2} \\ {{vp}\quad 3} \end{bmatrix} & {{for}\quad u\quad 4} \end{pmatrix}}} & (23) \end{matrix}$ Alternatively, u0 and u4 can be expressed as $\begin{matrix} \begin{matrix} {{u\quad 0\quad{or}\quad u\quad 4} = {\cos\quad 4{\theta \cdot \left( {{d\quad 0} + {d\quad 1} + {d\quad 2} + {d\quad 3}} \right)}}} \\ {= {0.1011\quad 0101\quad 0000\quad 0101 \times \left( {{d\quad 0} + {d\quad 1} + {d\quad 2} + {d\quad 3}} \right)}} \\ {= {\left\lbrack {2^{- 1} + 2^{- 3} + 2^{- 4} + 2^{- 6} + 2^{- 8} + 2^{- 14} + 2^{- 16}} \right\rbrack \times}} \\ {\left( {{d\quad 0} + {d\quad 1} + {d\quad 2} + {d\quad 3}} \right)} \end{matrix} & (24) \end{matrix}$ The manner in which the input data values are combined determines whether an adder network implementing these cosine coefficients produces u0 or u4 as an output data value. The calculation of u2 and u6 is similar, based on the following $\begin{matrix} {\begin{matrix} {{u\quad 2\quad{or}\quad u\quad 6} = {{\cos\quad 2{\theta \cdot \left( {{d\quad 0} + {d\quad 2}} \right)}} + {\cos\quad 6{\theta \cdot \left( {{d\quad 1} + {d\quad 3}} \right)}}}} \\ {{= {{1.000\overset{\_}{1}\quad 0\overset{\_}{1}00\quad 1000\quad 010\overset{\_}{1} \times \left( {{d\quad 0} + {d\quad 2}} \right)} +}}\quad} \\ {0.10\overset{\_}{1}0\quad 0010\quad 0000\quad\overset{\_}{1}000 \times \left( {{d\quad 1} + {d\quad 3}} \right)} \\ {= {{\left( {{d\quad 0} + {d\quad 2}} \right) \times 2^{0}} + {\left( {{d\quad 1} + {d\quad 3}} \right) \times 2^{- 1}} + {\left\lbrack {- \left( {{d\quad 1} + {d\quad 3}} \right)} \right\rbrack \times 2^{- 3}} +}} \\ {{\left\lbrack {- \left( {{d\quad 0} + {d\quad 2}} \right)} \right\rbrack \times 2^{- 4}} + {\left\lbrack {- \left( {{d\quad 0} + {d\quad 2}} \right)} \right\rbrack \times 2^{- 6}} + {\left( {{d\quad 1} + {d\quad 3}} \right) \times 2^{- 7}} +} \\ {{\left( {{d\quad 0} + {d\quad 2}} \right) \times 2^{- 9}} + {\left\lbrack {- \left( {{d\quad 1} + {d\quad 3}} \right)} \right\rbrack \times 2^{- 13}} + {\left( {{d\quad 0} + {d\quad 2}} \right) \times 2^{- 14}} +} \\ {\left\lbrack {- \left( {{d\quad 0} + {d\quad 2}} \right)} \right\rbrack \times 2^{- 16}} \end{matrix}{{{where}\begin{bmatrix} {d\quad 0} \\ {d\quad 1} \\ {d\quad 2} \\ {d\quad 3} \end{bmatrix}} = {\begin{pmatrix} \begin{bmatrix} {{vp}\quad 0} \\ {{vp}\quad 1} \\ {{- {vp}}\quad 3} \\ {{- {vp}}\quad 2} \end{bmatrix} & {{for}\quad u\quad 2} \\ \begin{bmatrix} {{vp}\quad 2} \\ {{vp}\quad 0} \\ {{- {vp}}\quad 1} \\ {{- {vp}}\quad 3} \end{bmatrix} & {{for}\quad u\quad 6} \end{pmatrix}.}}} & (25) \end{matrix}$

FIG. 4 illustrates a preferred embodiment of the present invention for a two-dimensional IDCT transform. Sets of input data values are received sequentially and summed in parallel. The block labeled data split 410 includes sequential-in-parallel-out registers. There are five lines 411 into data split 410. The first input line 411 is a 12 bit precision input data value for data to be transformed. Successive data values constitute a set. In one preferred embodiment, a set of input data values consists of eight values, u0 . . . u7. Successive sets of data constitute an 8 by 8 matrix of values. In an alternative embodiment, a set of input data values would consist of 16 values and successive sets of input data would constitute a 16 by 16 matrix of values. Data split 410 presents successive sets of input data values one set at a time. The second input line 411 is a 15 bit precision input data value for data that is being transformed a second time, to realize a two-dimensional IDCT. The third control line 411 is connected to a state machine which is not illustrated. This control line indicates whether the data passing through the data split circuit 410 is a set of unprocessed input data values or data that has already been processed through a one-dimensional IDCT transform. The fourth control line 411 is a wait control signal from the state machine which can be used to suspend the operation of the IDCT calculation. The fifth control line 411 is connected to a system clock. The data split circuit 410 includes logic to partition serial input data values to produce the parallel output vectors u_(e) and u_(o), essentially as shown in equations (7) and (8). There are eight output lines, labeled 412 and 413. The four output lines 412 coupled to the block load u_(p) data 420 carry the even indexed data values u6, u4, u2 and u0. These are 15 bit precision data values. Similarly, the four output lines 413 coupled to the load u_(n) data block 425 carry the odd indexed values of an input data set.

The blocks labeled load u_(p) data 420 and the load u_(n) data 425 include buffer registers. Input lines 412 and 413 carry 15 bit precision data values. Load u_(p) data 420 includes logic to combine inputs u6, u4, u2 and u0 received on lines 412 into operands d0, d1, d2, and d3 which are output on lines 422 essentially as shown in equation (13) of FIG. 2A & FIG. 2B. There are four control inputs 421 to load u_(p) data 420. The first control input in this preferred embodiment is a wait control signal from a state machine which can be used to suspend the operation of the IDCT calculation. The second control input is a select signal from a state machine which controls the mapping between input data values 412 and output data values 422. The third control input indicates whether the data passing through this block is a set of unprocessed input data values or data that has already been transformed once. The fourth control input is connected to the system clock.

The input data values, input control signals and output operands for load u_(n) data 425 are essentially the same as for 420. The difference between load u_(p) data and load u_(n) data in this preferred embodiment is essentially as in equations (13) and (15).

V_(p) processing 430, includes a adder network that accepts operands in parallel and accomplishes part of the multiplication in equation (13). In a preferred embodiment, the coefficient submatrix by which the operands are multiplied is embodied in the routing of bits of the operands to adders in the networks. Networks of carry save adders and adders, preferably ending in a carry propagate adder, execute additions and accumulations by parallel processing, to calculate the product of a vector and a coefficient submatrix. The operands accepted in parallel 422 are d0, d1, d2, and d3 in equation (13) of FIG. 2A & FIG. 2B. The output data value for these operands, which is one of two lines 432 coupled to DCT out processing 440. There are three control inputs 431 to v_(p) processing 430. The first control input to this preferred embodiment is a wait control signal from a state machine which can be used to suspend the operation of the IDCT calculation. The second control input indicates whether the data passing through this block of the circuit is a set of unprocessed input data values or data that has already been transformed once. The third control input is connected to the system clock.

The input operands, input control signals and output data values for v_(n) processing 435 are essentially the same as for v_(p) processing 430. The difference between the v_(n) processing and v_(p) processing blocks is essentially as in equations (13) and (15).

Taken together, the data split 410, the load data blocks 420 and 425, and the vector processing 430 and 435 include input lines, logic to present successive sets of input data values one set at a time, adder networks which accept input data values in parallel, and output lines.

The DCT out processing 440 performs the data rearrangement that is needed for the next stage of processing. Because a two-dimensional IDCT is computed in the preferred embodiment, there are two alternative next stages at 440. For either next stage, the DCT out processing 440 combine the values from v_(n) processing and v_(p) processing to generate the a series of output data sets also referred to as vectors v, essentially as in equations (13) and (15). Then, the DCT out processing alternatively transposes the sets of output data values for a matrix of output data sets or it rounds and outputs the sets of data values. In the first alternative, the sets of output data values are transposed so that they can be processed a second time to accomplish a two-dimensional IDCT transform. This logic to transpose is coupled back to the input lines.

In an alternative embodiment for performing DCT transforms, instead of IDCT transforms, the structure of the present invention varies somewhat from FIG. 4. The principal difference, apparent to one of skill in the art from the equations above, is that vectors of FIG. 2A & FIG. 2B and v_(n) are created from a set of input data values before processing through the adder network for a DCT transform, whereas they are combined to create a set of output data values after processing through the adder network for an IDCT transform. The transform matricies are similar, being $\lbrack u\rbrack = {\begin{bmatrix} u_{e} \\ u_{o} \end{bmatrix} = {\begin{bmatrix} C_{e} & 0 \\ 0 & C_{o} \end{bmatrix} \cdot \begin{bmatrix} v_{p} \\ v_{n} \end{bmatrix}}}$ for a DCT transform and $\begin{bmatrix} v_{p} \\ v_{n} \end{bmatrix} = {\begin{bmatrix} C_{e}^{T} & 0 \\ 0 & C_{o}^{T} \end{bmatrix} \cdot \begin{bmatrix} u_{e} \\ u_{o} \end{bmatrix}}$ for an IDCT transform. In both embodiments, processing of a two dimensional transform requires data transposition and further processing through adder networks.

In a further alternative embodiment, the second dimension of processing could be accomplished by repeating much of the logic in FIG. 4, instead of routing the data through a first adder networks twice. In other words, there would be a second data split 410′, second load data blocks 420′ and 425′, and second vector processing 430′ and 435′, all of which would be repeated after the DCT out processing 440. The DCT out processing 440 would transpose data sets and to the input lines to a second data split. A second DCT out processing 440′ including output logic would be coupled after the second adder networks. Thus, in this alternative embodiment, the logic of the DCT out processing 440 described above would be divided between two DCT out processing blocks, 440 and 440′.

FIG. 5 provides additional conceptual detail regarding vector processing, either 430 or 435. In a preferred embodiment, pre-add and round logic 511 receives operands 510. The pre-add and round unit 511 handles bit shifting to scale the operands before they are processed by the parallel adder network. In successive phases, controlled by the phase signal associated with 512, pre-added and rounded operands are routed to the adder network. Fifteen operands, for instance, are passed to the adder network as two sets of operands. The muxes 512 determine whether the first set of eight operands or the second set of seven operands, combined with the result of summing the first eight operands, are supplied to the adder network. In one preferred embodiment, the adder network includes four layers of carry save adders, sometimes otherwise referred to as full adders, which are illustrated in FIG. 5. As these carry save adders are full adders, each operand is full-length after scaling. Each of these carry save adders accepts three inputs and generates two outputs. When an IDCT transform is calculated by v_(p) processing of fifteen operands, on the first pass through eight operands are combined through muxes 512. The result is stored in register 572 and is passed to the parallel adder network through the muxes 512 via lines 582 and 513. On the second pass through, seven operands plus the result in register 572 are combined through muxes 512. The result of the second pass through is stored in register 571 and available on line 581.

The operation of CSA 522 is understood by reference to the following example.

where X, Y and Z are input operands and 3 . . . 0 indicate the relative significance of bits of the input operands. S0 is the result of ((X0 xor Y0) xor Z0) or an equivalent operation. C0 is the carry, if the majority of X0, Y0 and Z0 are “1”s. An advantage of a CSA with two outputs over other adders, such as carry propagate adders (CPA), is that all of the bits in operands X, Y and Z are added in parallel, without waiting for the sums of less significant bits to propagate to more significant bits. CSA 522 operates in this fashion: the output of 522 includes a save (as S0) and a carry (as C0) which may be the sum of the scaled operands (d0-d2), (−d3), and (−(d1-d0)).

One of the outputs of CSA 522 is routed to CSA 531 and the other to CSA 532. The routing in a preferred embodiment through four levels of CSAs is dictated by limiting each CSA to three inputs. The depth of this adder network is determined by how many levels of adders are required to combine the pre-added and rounded operands. At the bottom of the adder network is an adder that produces a single output from two inputs. In a preferred embodiment, this adder is a carry propagate adder.

Coupled to CPA 560 are registers 571 and 572. In the first phase of accumulation (phase equal 0), the sum of eight operands is stored in register 572. The value in this register is output on line 582, which is connected to line 513, an input to CSA 532. In the second phase of accumulation (phase equal 1), the remaining operands are combined with the value in register 572 as input to the parallel adder network. The final summation of these operands is accomplished by CPA 560, which stores the result in register 571. In a preferred embodiment of the present invention, only two clock cycles are needed to accumulate as many as fifteen operands that have been pre-added and rounded. In effect, in two clock cycles, a set of pre-added and rounded input values has been multiplied by the coefficients in a row of an IDCT transform matrix and summed. By efficient matrix factoring and use of an adder network which accomplishes processing in parallel, both the time and the hardware cost for performing an IDCT transform are reduced.

FIG. 6 illustrates a method and apparatus for accepting eight inputs in serial and outputting them in parallel, as performed in block 410 of FIG. 4. The first input line 411 corresponds to the input From INVQ to MUX 601, providing data input from an inverse-quantizer. The second input line 411 corresponds to input From TRAM to MUX 601. Input From TRAM is used to accomplish a 2-D IDCT in two passes through a 1-D IDCT calculator. TRAM is a temporary buffer that stores the result of the first-pass 1-D IDCT. The third control line 411 corresponds to control signal S_ID_R. The fourth control line 411 corresponds to the wait signal to register 602. The fifth control signal 411 is a clock signal which is omitted here. The P_RST reset signal is used to reset register 602. Data value are received through MUX 601 and passed sequentially from register to register 603, taking eight clock cycles to receive eight data values for parallel output.

FIGS. 7 and 8 illustrate the permutation of data from inputs to produce a vector d0 . . . d3 for each of the vectors vp0 . . . vp3 and vn0 . . . vn3 according to FIGS. 2B and 3B. FIG. 7 illustrates the permutation engine for sequentially generating vp0, vp2, vp3 and vp1. According to FIG. 2B, the vector d0 . . . d3 for vp0 is simply u0, u2, u4, u6. When the signal S=1 is received by MUXes 711-714, the input values from FIG. 6 are loaded, producing vp0. In subsequent passes, S=0 and the input values are permuted and sometimes twos-complemented. To produce vp2 in the second pass, the permutation engine uses the value D2 in register 723. It twos-complements this value and passes it through MUX 711 to register 721. Similarly, in the second pass, the value D4 in register 722 is twos-complemented and passed through MUX 712 to register 721. This permutation engine produces vp1 from vp3 from vp2 from vp0, in turn. In four passes, the vectors corresponding to vp0 . . . vp3 are generated. To further explain FIG. 7, it should be clear that 701 is the logic for generating the control signal S, used to control MUXes 711-714 from the input control signals 702. The inputs u0 . . . u6 are 15 bit values. The registers 721-724 are clocked by the signal CLK. the group of registers can be reset responsive to the signal P_RST. FIG. 8 illustrates the permutation engine for vn0 . . . vn3 according to FIG. 3B. In this engine, only one input needs to be two-complemented with each permutation of inputs.

FIGS. 9 and 10 further explain the two-pass operation of the adder network in FIG. 5. Referring to FIG. 9, in a first pass, a preadder for v_(p) processing produces the intermediate values x, y, z and d3B. At the same time, an adder network as illustrated in FIG. 5 processes the boxed coefficients. In a second pass, the intermediate values replace the non-boxed coefficients and are combined with the result of the first pass in the adder network. Similarly, for FIG. 10, in the first pass a preadder for v_(n) processing produces the intermediate values w, x, y, z, zz and d3B. To reduce the number of operands processed by the adder network in the second pass, the preadder combines two coefficients, D3*2⁻¹⁰-D1*2⁻¹¹, as zz=(D3-(½)D1)*2⁻¹⁰. At the same time, an adder network as illustrated in FIG. 5 processes the eight boxed coefficients for 2⁰ . . . 2⁻⁴. In a second pass, the intermediate values replace the non-boxed coefficients and are combined with the result of the first pass in the adder network.

The foregoing description of the preferred embodiment of the invention has been presented for purposes of illustration and description. The description is not intended to be exhaustive or to limit the invention to the precise form disclosed. Obviously, many modifications and variations will be apparent to practitioners skilled in this art. It is intended that the scope of the invention be defined by the following claims and their equivalents. 

1. A permutation device accepting an input a set u₀, u₂, u₄ and u₆ and producing successive outputs sets (u₀, u₂, u₄, u₆), (u₀, u₆, −u₄, −u₂,), (u₀, −u₂, u₄, −u₆), and (u₀, −u₆, −u₄, u₂,), comprising: muxes 0 . . . 3 coupled, respectively, to inputs u₀, u₂, u₄ and u₆; registers 0 . . . 3 coupled to the output of muxes 0 . . . 3, wherein register 0 also is coupled to the input of mux 0, register 1 is coupled to the input of mux 3, register 2 is coupled to the input of mux 2 and register 3 is coupled the input of to mux 1; and a control line coupled to the muxes, wherein muxes 0 . . . 3 select between inputs and register couplings in response to the control line.
 2. The device of claim 1, wherein register 1 is coupled to the input of mux 3 through additive inverse logic and register 2 is coupled to the input of mux 2 through additive inverse logic.
 3. A permutation device accepting an input a set u₁, u₃, u₅ and u₇ and producing successive outputs sets (u₁, u₃, u₅, u₇), (−u₃, u₇, u₅, u₁), (−₇, u₅, u₁, −u₃), and (−u₅, u₁, −u₃, −u₇), comprising: muxes 0 . . . 3 coupled, respectively, to inputs u₁, u₃, u₅ and u₇; registers 0 . . . 3 coupled to the output of muxes 0 . . . 3, respectively, and register 0 is also coupled to the input of mux 3, register 1 is coupled to the input of mux 0, register 2 is coupled to the input of mux 1 and register 3 is coupled to the input of mux 2; and a control line coupled to the muxes, wherein muxes 0 . . . 3 select between inputs and register couplings in response to the control line.
 4. The device of claim 3, wherein register 1 is coupled to the input of mux 0 through additive inverse logic. 